#ifndef CAMERA_H
#define CAMERA_H

#include "Game Engine/Header/d3dUtil.h"

// Simple camera class that lets the viewer explore the 3D scene.
//   -It keeps track of the camera coordinate system relative to the world space
//    so that the view matrix can be obtained.  
//   -It keeps track of the viewing frustum of the camera so that the projection
//    matrix can be obtained.
class Camera
{
public:
	Camera();
	~Camera();

	enum Type
	{
		Free,
		FirstPerson,
		ThirdPerson
	};

	D3DXVECTOR3& Position();

	D3DXMATRIX View()const;
	D3DXMATRIX Proj()const;

	void SetType( Type cameraType );

	void SetLens(float fovY, float aspect, float zn, float zf);

	void Strafe(float d);
	void Walk(float d);

	void Pitch(float angle);
	void RotateY(float angle);

	void RebuildView();

	D3DXVECTOR3& GetCameraRight();
	D3DXVECTOR3& GetCameraLook();

	D3DXMATRIX mProj;

private:
	std::wstring x;
	std::wstring y;
	std::wstring z;

	D3DXVECTOR3 mPosition;
	D3DXVECTOR3 mRight;
	D3DXVECTOR3 mUp;
	D3DXVECTOR3 mLook;

	D3DXMATRIX mView;

	Type mCameraType;
};

Camera& GetCamera();

#endif // DEMO_CAMERA_H